package com.yjq.dao.impl;

import com.yjq.dao.BaseDao;
import com.yjq.dao.TriangleDao;
import com.yjq.pojo.Triangle;

import java.util.List;

/**
 * @author 尹嘉琪
 * @create 2021-12-23 0:44
 */
public class TriangleDaoImpl extends BaseDao implements TriangleDao {
    @Override
    public int insertTriangle(Triangle triangle) {
        String sql = "insert into triangle(width,height,hypotenuse,shape) values (?,?,?,?)";
        return update(sql,triangle.getWidth(), triangle.getHeight(), triangle.getHypotenuse(), triangle.getShape());
    }

    @Override
    public List<Triangle> queryListForAll() {
        String sql = "select * from triangle";
        return queryForList(Triangle.class, sql);
    }
}
